<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="UTF-8">
		<title>操作当当购物车页面</title>
		<link type="text/css" rel="stylesheet" href="css/cartStyle.css" />
		<script>
			function minus(t){
			//t就是‘-’按钮
			var i=t.nextElementSibling;
			if(i.value<=1)
				return false;
			i.value--;
		}
		function plus(t){
			t.previousElementSibling.value++;
			//更新总价
			
			//
			//jiesuan
			//
			
		}
		function jiesuan(){
			var str="";
			var cart=document.getElementById("cartList");
			for(var i=1;i<cart.children.length-1;i++){
				var ul=cart.children[i];
				str+=ul.children[1].innerHTML;//书名
				str+=":"+ul.children[4].innerHTML+"\n";
			}
			document.getElementById("ptotal").innerHTML=str;
		}
	</script>
	</head>
	<body>

		<div class="content">
			<div class="logo">
				<img src="images/dd_logo.jpg"><span onclick="close_plan();">关闭</span>
			</div>
			<div class="cartList" id="cartList">
				<ul>
					<li>商品图片</li>
					<li>商品信息</li>
					<li>单价</li>
					<li>数量</li>
					<li>总价</li>
					<li>操作</li>
				</ul>
				<ul>
					<li><img src="images/dog.jpg"></li>
					<li>我和狗狗活下来了</li>
					<li>¥<input type="text" name="price" value="21.90"></li>
					<li><input type="button" name="minus" value="-" onclick="minus(this);"><input type="text" name="amount" value="1"><input
						 type="button" name="plus" value="+" onclick="plus(this);"></li>
					<li id="price0">¥21.90</li>
					<li>
						<p onclick="collection();">移入收藏</p>
						<p onclick="del(this);">删除</p>
					</li>
				</ul>
				<ul>
					<li><img src="images/mai.jpg"></li>
					<li>灰霾来了怎么办</li>
					<li>¥<input type="text" name="price" value="24.00"></li>
					<li><input type="button" name="minus" value="-" onclick="minus(this);"><input type="text" name="amount" value="1"><input
						 type="button" name="plus" value="+" onclick="plus(this);"></li>
					<li id="price1">¥24.00</li>
					<li>
						<p onclick="collection();">移入收藏</p>
						<p onclick="del(this);">删除</p>
					</li>
				</ul>
				<ul>
					<li><img src="images/mai.jpg"></li>
					<li>钢铁是怎样炼成的</li>
					<li>¥<input type="text" name="price" value="104.00"></li>
					<li><input type="button" name="minus" value="-" onclick="minus(this);"><input type="text" name="amount" value="1"><input
						 type="button" name="plus" value="+" onclick="plus(this);"></li>
					<li id="price2">¥104.00</li>
					<li>
						<p onclick="collection();">移入收藏</p>
						<p onclick="del(this);">删除</p>
					</li>
				</ul>
				<ul>
					<li><img src="images/mai.jpg"></li>
					<li>母猪诊断学</li>
					<li>¥<input type="text" name="price" value="55.00"></li>
					<li><input type="button" name="minus" value="-" onclick="minus(this);"><input type="text" name="amount" value="1"><input
						 type="button" name="plus" value="+" onclick="plus(this);"></li>
					<li id="price3">¥55.00</li>
					<li>
						<p onclick="collection();">移入收藏</p>
						<p onclick="del(this);">删除</p>
					</li>
				</ul>
				<ol>
					<li id="totalPrice">商品总计：<span></span></li>
					<li onclick="jiesuan()"><span>结 算</span></li>
				</ol>
			</div>
		</div>
		<p id="ptotal" style="color: red;border: 1px solid red;"></p>
	</body>
</html>
